// 工程质量-评估
import { req } from '@/utils/request'

// 版本
export const listVersion = data => req.get('/cq/cqEvalVersion/list', data)
export const addVersion = data => req.post('/cq/cqEvalVersion/add', data)
export const updateVersion = data => req.post('/cq/cqEvalVersion/edit', data)
export const delVersion = versionId => req.post(`/cq/cqEvalVersion/delete?versionId=${versionId}`)
export const copyVersion = data => req.post('/cq/cqEvalVersion/copyVersion', data)

// 检查项
export const listChkitem = data => req.get('/cq/cqEvalChkitem/list', data)
export const addChkitem = data => req.post('/cq/cqEvalChkitem/add', data)
export const updateChkitem = data => req.post('/cq/cqEvalChkitem/edit', data)
export const delChkitem = chkitemId => req.post(`/cq/cqEvalChkitem/delete?chkitemId=${chkitemId}`)
// 获取子级
export const listNextLevel = data => req.get('/cq/cqEvalChkitem/listNextLevel', data)

// 检查项配置
export const listChkitemCfg = data => req.get('/cq/cqEvalChkitemCfg/list', data)
export const addChkitemCfg = data => req.post('/cq/cqEvalChkitemCfg/add', data)
export const updateChkitemCfg = data => req.post('/cq/cqEvalChkitemCfg/edit', data)
export const delChkitemCfg = cfgId => req.post(`/cq/cqEvalChkitemCfg/delete?cfgId=${cfgId}`)
// 检查项分类
export const chkitemTypeList = data => req.get('/cq/cqEvalChkitemCfg/chkitemTypeList', data)
// 历史版本分类
export const historyChkList = data => req.get('/cq/cqEvalChkitemCfg/historyChkList', data)

// 项目检查列表
export const pageScorePrjchk = data => req.get('/cq/cqEvalPrjchk/pageScore', data)
// 保存检查项得分
export const saveScores = data => req.post('/cq/cqEvalChkitemScore/saveScores', data)
// 删除结果
export const deletePrjchk = prjchkId => req.get(`/cq/cqEvalPrjchk/deletePrjchk?prjchkId=${prjchkId}`)
// 查询结果详情
export const listScoreInfo = data => req.get('/cq/cqEvalChkitemScore/listScoreInfo', data)
// 解锁
export const enableTaskPrjchk = data => req.get('/cq/cqEvalPrjchk/enableTask', data)
// 锁定
export const disableTaskPrjchk = data => req.get('/cq/cqEvalPrjchk/disableTask', data)
// 项目操盘类型
export const getProTradeType = data => req.get('/cq/cqEvalPrjchk/getProTradeType', data)
// 导出报表
export const exportReportPrjchk = data => req.get('/cq/cqEvalPrjchk/exportPrjchkScore', data, { responseType: 'arraybuffer' })

// 品质考核得分锁定
export const lockPage = data => req.get('trd/score/cfg/page', data)
export const lockAddUpdate = data => req.post('trd/score/cfg/addOrUpdate', data)
export const lockRemove = id => req.post(`trd/score/cfg/remove?id=${id}`)
export const lockBatchRemove = data => req.post('trd/score/cfg/batchRemove', data)

// 检查类别维护
export const getCategory = data => req.get('/cq/cqEvalCategory/list', data)
export const addCategory = data => req.post('/cq/cqEvalCategory/add', data)
export const setCategory = data => req.post('/cq/cqEvalCategory/edit', data)
export const delCategory = evalCategoryId => req.get(`/cq/cqEvalCategory/delete?evalCategoryId=${evalCategoryId}`)

// 房屋空间维护
export const getRoomspace = data => req.get('/cq/cqEvalRoomspace/list', data)
export const addRoomspace = data => req.post('/cq/cqEvalRoomspace/add', data)
export const setRoomspace = data => req.post('/cq/cqEvalRoomspace/edit', data)
export const delRoomspace = spaceId => req.get(`/cq/cqEvalRoomspace/delete?spaceId=${spaceId}`)

// 问题录入
export const getProblem = data => req.get('/cq/cqEvalProblem/list', data)
export const addProblem = data => req.post('/cq/cqEvalProblem/add', data)
export const setProblem = data => req.post('/cq/cqEvalProblem/edit', data)
export const delProblem = evalProblemId => req.delete(`/cq/cqEvalProblem/${evalProblemId}`)
export const getProblemInfo = evalProblemId => req.get(`/cq/cqEvalProblem/${evalProblemId}`)

// 问题整改详情
export const getScoreItemDetail = data => req.get('/cq/cqRdcPrjchkRectify/getScoreItemDetail', data)
